--- @param extension Package
--- @param HY HY_Utility
--- @param U Utility
return function(extension, HY, U)
    local hy_toyosatomimi_no_miko = General:new(extension, "hy_toyosatomimi_no_miko", "ten_k", 4, 4, General.Female)
    local destiny_master = fk.CreateSkill {
        name = "destiny_master",
    }
    destiny_master:addEffect("viewas", {
        mute_card = false,
        anim_type = "offensive",
        pattern = "archery_attack",
        times = function(self, player)
            return 2 - player:getMark("destiny_master_record-turn")
        end,
        card_filter = function(self, player, to_select, selected)
            if #selected <= 2 then
                return Fk:currentRoom():getCardArea(to_select) ~= Player.Equip
            end
        end,
        prompt = function(self, selected, selected_cards)
            return "destiny_master_prompt"
        end,
        view_as = function(self, player, cards)
            if #cards ~= 2 then
                return nil
            end
            local c = Fk:cloneCard("archery_attack")
            c:addSubcards(cards)
            c.skillName = destiny_master.name
            return c
        end,
        enabled_at_play = function(self, player)
            return player:usedEffectTimes(destiny_master.name, Player.HistoryPhase) < 1
        end,
    })
    destiny_master:addEffect(fk.Damaged, {
        can_trigger = function(self, event, target, player, data)
            local choices = { "destiny_master_discard", "destiny_master_recover" }
            if target:isAllNude() then
                table.removeOne(choices, "destiny_master_discard")
            end
            if not target:isWounded() then
                table.removeOne(choices, "destiny_master_recover")
            end
            return player:hasSkill(destiny_master.name) and data.from and data.from == player and data.card and data.card.name == "archery_attack" and
                player:usedEffectTimes(self.name, Player.HistoryTurn) < 2 and
                #choices > 0 and not target.dead
        end,
        on_cost = function(self, event, target, player)
            local choices = { "destiny_master_discard", "destiny_master_recover", "Cancel" }
            if target:isAllNude() then
                table.removeOne(choices, "destiny_master_discard")
            end
            if not target:isWounded() then
                table.removeOne(choices, "destiny_master_recover")
            end
            if #choices == 1 then
                return
            end
            event:setCostData(self, player.room:askToChoice(player, {
                choices = choices,
                skill_name = destiny_master.name,
                prompt = "destiny_master_choice_prompt"
            }))
            return event:getCostData(self) ~= "Cancel"
        end,
        on_use = function(self, event, target, player)
            local room = player.room
            room:addPlayerMark(player, "destiny_master_record-turn", 1)
            if event:getCostData(self) == "destiny_master_discard" then
                local cardId = room:askToChooseCard(player, {
                    target = target,
                    flag = "hej",
                    skill_name = destiny_master.name
                })
                room:throwCard({ cardId }, destiny_master.name, target, player)
            elseif target:isWounded() then
                room:recover({
                    who = target,
                    num = 1,
                    recoverBy = player,
                    skillName = destiny_master.name
                })
            end
        end,
    })
    local tellurion = fk.CreateSkill {
        name = "tellurion",
    }
    tellurion:addEffect(fk.EventPhaseStart, {
        times = function(self, player)
            return 1 - player:usedSkillTimes(tellurion.name, Player.HistoryRound)
        end,
        can_trigger = function(self, event, target, player, data)
            return player:hasSkill(tellurion.name) and target.phase == Player.Discard and player:usedSkillTimes(tellurion.name, Player.HistoryRound) < 1 and not target.dead
        end,
        on_cost = function(self, event, target, player)
            local room = player.room
            local choices = { "tellurion_draw", "tellurion_discard", "Cancel" }
            if target:isNude() then
                table.insert(choices, "tellurion_discard")
            end
            event:setCostData(self, room:askToChoice(player, {
                choices = choices,
                skill_name = tellurion.name,
                prompt = "tellurion_prompt::" .. target.id,
                all_choices = { "tellurion_draw", "tellurion_discard", "Cancel" }
            }))
            return event:getCostData(self) ~= "Cancel"
        end,
        on_use = function(self, event, target, player)
            local room = player.room
            if event:getCostData(self) == "tellurion_discard" then
                local cardIds = table.connect(table.filter(target.player_cards[Player.Hand], function(id)
                    return not target:prohibitDiscard(Fk:getCardById(id))
                end), table.filter(target.player_cards[Player.Equip], function(id)
                    return not target:prohibitDiscard(Fk:getCardById(id))
                end))
                local num = #cardIds
                if num > 0 then
                    room:throwCard(cardIds, tellurion.name, target, target)
                    room:drawCards(target, num, tellurion.name)
                end
            else
                room:drawCards(target, 2, tellurion.name)
            end
        end,
    })
    extension:loadSkillSkels { destiny_master, tellurion }
    hy_toyosatomimi_no_miko:addSkill("destiny_master")
    hy_toyosatomimi_no_miko:addSkill("tellurion")
    Fk:loadTranslationTable {
        ["hy_toyosatomimi_no_miko"] = "丰聪耳神子",
        ["#hy_toyosatomimi_no_miko"] = "广闻明君",
        ["illustrator:hy_toyosatomimi_no_miko"] = "魔界の住民",
        ["designer:hy_toyosatomimi_no_miko"] = "黑曜人形",
        ["cv:hy_toyosatomimi_no_miko"] = "",

        ["destiny_master"] = "司道",
        [":destiny_master"] = "出牌阶段限一次，你可以将两张手牌当作【万箭齐发】使用。每回合限两次，你使用【万箭齐发】对一名角色造成伤害后，你可以选择一项：1.弃置其区域内一张牌；2.令其回复1点体力。",
        ["destiny_master_discard"] = "弃置该角色区域内一张牌",
        ["destiny_master_recover"] = "令该角色回复一点体力",
        ["destiny_master_choice_prompt"] = "司道：你可以选择一项”",
        ["destiny_master_prompt"] = "司道：将两张手牌当作【万箭齐发】使用",

        ["tellurion"] = "天球",
        [":tellurion"] = "每轮限一次，一名角色弃牌阶段开始时，你可以选择一项：1.令其弃置所有牌并摸等量的牌；2.令其摸两张牌。",
        ["tellurion_prompt"] = "天球：你可以对%dest执行一项",
        ["tellurion_discard"] = "弃置所有牌并摸等量的牌",
        ["tellurion_draw"] = "摸两张牌",
    }
end
